package com.yuncheng.spcyApi.constant.flow;

import com.yuncheng.spcyApi.constant.common.SpcyConstant;
import org.springframework.stereotype.Component;

@Component(value = "ndkpConstant")
public class NdkpConstant implements FlowConstant {

    public final static String NODENAME = "考评登记,个人总结,考评审核,考评复核,考评审批";

    public final static String HJMC_KPDJ = "考评登记";
    public final static String HJMC_GRZJ = "个人总结";
    public final static String HJMC_DSHRW = "考评审核";
    public final static String HJMC_DFHRW = "考评复核";
    public final static String HJMC_DSPRW = "考评审批";

    // 流程办理按钮类型 - 保存
    public final static String SUBMIT_TYPE_SAVE = "0";

    // 流程办理按钮类型 - 提交
    public final static String SUBMIT_TYPE_SUBMIT = "1";

    @Override
    public String getNextNodeName(String currentNodeName) {
        String nodeNameList[] = NODENAME.split(",");
        for (int i=0; i<nodeNameList.length; i++){
            if (nodeNameList[i].equals(currentNodeName)){
                if (i == nodeNameList.length-1){
                    return HJMC_LCJS;
                }else {
                    return nodeNameList[i+1];
                }
            }
        }
        return "";
    }

    // 获取上一个环节名称
    public String getPreviousName(String nowNodeName){
        String[] nodeNameList = NODENAME.split(",");

        for (int i=0; i<nodeNameList.length; i++){
            if (nodeNameList[i].equals(nowNodeName)){
                if (i==0){
                    return nodeNameList[i];
                }else {
                    int perviousI = i-1; // 上一个环节名称
                    return nodeNameList[perviousI];
                }
            }
        }
        return "";
    }

    @Override
    public String getSpNextNodeName(String currentNodeName) {
        return null;
    }

    @Override
    public String getSpPreviousName(String currentNodeName) {
        return null;
    }

    @Override
    public String getFirstNode() {
        String nodeNameList[] = NODENAME.split(",");
        return nodeNameList[0];
    }

    @Override
    public String getBlfs(String nodeName) {
        return SpcyConstant.BLFS_DRJJ;
    }

    @Override
    public String getFywflcode() {
        return "ndkp001";
    }

    @Override
    public String getFlowName() {
        return "年度考评-考评流程";
    }
}
